/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package surveyservice;


import com.google.gson.Gson;
import com.vng.zing.survey.thrift.client.SurveyClient;
import com.vng.zing.survey.thrift.model.AnswerItem;
import com.vng.zing.survey.thrift.model.QuesType;
import com.vng.zing.survey.thrift.model.Question;
import com.vng.zing.survey.thrift.model.QuestionStats;
import com.vng.zing.survey.thrift.model.Response;
import com.vng.zing.survey.thrift.model.SurveyItem;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import com.vng.zing.survey.data.*;

/**
 *
 * @author kienpd
 */
public class TestClient {
 
        public static void main(String[] args) throws Exception {
            SurveyItem survey = new SurveyItem();
            survey.setTitle(" khao sat sfsf");
            survey.setDescription("day la mau test");
            survey.setCreatedDay(1111111);
            survey.setBeginDay(222222);
            survey.setEndDay(333333333);
            survey.setPoint((short)10);
            survey.setStatus(true);
            survey.setOption(false);
            List<Question> listQue = new ArrayList<Question>();
            Question q = new Question();
            q.setTitleQues("bạn tên gì?");
            q.setIdQues((short)1);
            q.setHelpText("phạm dức kiện");
            q.setRequire(true);
            q.setType(QuesType.SINGLE_LINE);
            Question q1 = new Question();
            q1.setTitleQues("ban thic mau gì");
            q1.setIdQues((short)2);
            q1.setHelpText("");
            q1.setRequire(false);
            q1.setType(QuesType.MULTI_CHOICE);
            List<String> choice = new ArrayList<String>();
            choice.add("đỏ");
            choice.add("xanh ");
            choice.add("tim");
            q1.setChoices(choice);
            listQue.add(q);
            listQue.add(q1);
            survey.setQuestions(listQue);
            Gson gson = new Gson();
            Response response = new Response();
                     
            ResponseData.getInstance().setResponse(1, 2, response);
            if(ResponseData.getInstance().getResponse(1, 2)!=null){
             System.out.println(gson.toJson(ResponseData.getInstance().getResponse(1, 2)));
            }
           
            
       //   System.out.print(SurveyClient.getInstance().newSurvey(100, survey));
//          System.out.println(gson.toJson(SurveyClient.getInstance().getSurvey(25)));
   
            
     //       Response response = new Response();
   //       AnswerItem answerItem = new AnswerItem(QuesType.SINGLE_LINE, (short)1, "vcfvdsfsdfs");
    //       AnswerItem answerItem1 = new AnswerItem(QuesType.MULTI_CHOICE, (short)2, "1,0,1");
          //  List<AnswerItem> listAns = new ArrayList<>();
        ///   listAns.add(answerItem);
          //  listAns.add(answerItem1);
//            response.setAnswers(listAns);
//            response.setIdUser(1);
//          //  SurveyClient.getInstance().checkUser(232, 25);
  //       SurveyClient.getInstance().newResponse(123, 31, response);
           //     Gson gson = new Gson();
             // System.out.print(gson.toJson(SurveyClient.getInstance().listQuesCanEdit(31)));
         //           ResponseData.get
           
     }
    }
